sound object

This method will stop the sound playback.

bool stop()

Parameters:
None.

Return value:
true on success, false on failure.

Remarks:
This method will stop the playback of the sound, resetting its position to the beginning of the file. Thus, it will start from the very beginning the next time the "play" method is called.

Example:
// Play a sound and let the user pause and unpause it with the space bar, stop it with enter and exit with escape.

void main()
{
sound ambience;
show_game_window("Sound Test");
ambience.load("curry.wav");
if(ambience.active==false)
{
alert("Error", "The sound could not be loaded.");
exit();
}
ambience.play();
while(true)
{
if(key_pressed(KEY_SPACE))
{
if(ambience.playing==true)
{
ambience.pause();
}
else
{
ambience.play();
}
}
if(key_pressed(KEY_RETURN))
{
ambience.stop();
}
if(key_pressed(KEY_ESCAPE))
{
break;
}
wait(5);
}
}